#ifndef MOUSEEVENT_H
#define MOUSEEVENT_H
#include <QWidget>
#include <QMouseEvent>
#include <QCloseEvent>
#include <QMessageBox>
#include <QtDebug>

class MouseEvent:public QWidget
{
public:
    MouseEvent(QWidget *parent);
    void setTitleBarHidden(bool);
protected:
    void mouseMoveEvent(QMouseEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void closeEvent(QCloseEvent *event) override;
    //void mouseDoubleClickEvent(QMouseEvent *event) override;


private:
    enum Edge {
            EdgeNone,
            EdgeTop,
            EdgeBottom,
            EdgeLeft,
            EdgeRight,
            EdgeTopLeft,
            EdgeTopRight,
            EdgeBottomLeft,
            EdgeBottomRight
        };
    QPoint m_dragPosition;
    const int EDGE_MARGIN = 5 * devicePixelRatio(); // 边缘检测范围
    bool m_isDragging = false;//
    Edge m_dragEdge = EdgeNone;
    Edge getEdge(const QPoint &pos) const;
    void setCursorShape(Edge edge);
};

#endif // MOUSEEVENT_H
